package com.yjtc.cbg.retrofitsearchdemo.model;

import com.yjtc.cbg.retrofitsearchdemo.bean.UserInfoBean;
import com.yjtc.cbg.retrofitsearchdemo.factory.serviceFactory;
import com.yjtc.cbg.retrofitsearchdemo.model.inter.mainInter;
import com.yjtc.cbg.retrofitsearchdemo.view.MainActivity;
import com.yjtc.cbg.retrofitsearchdemo.view.inter.mainViewInter;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by chenboge on 16/7/10.
 */
public class mainModel {

    public static void getUserInfo(final mainViewInter activity) {
        mainInter inter = serviceFactory.createServiceForm(mainInter.class, mainInter.apiStr);

        inter.getUserInfo().subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(activity::updateUI);
    }

}
